<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="layout/layout">
<head>
    <meta charset="UTF-8">
    <title>添加好友</title>
</head>
<body>
<div class="page-login-wrap">
    <div align="center">
        <form action="/user/getUserLikeUsername" method="post">
            <div class="form-item">
                <i class="vd-icon icon-password"></i>
                用户名:<input type="text" name="username" id="username" placeholder="请输入用户名" class="login-input" th:value="${username}">
            </div>
            <div class="form-btn">
                <button type="submit" class="btn btn-blue">查询</button>
            </div>
        </form>
    </div>

    <div th:if="${flag} == 1" align="center">
        没有找到相关用户!
    </div>

    <div th:if="${userList} != null">
        <table class="table" align="center">
            <colgroup>
                <col width="250px">
                <col width="250px">
            </colgroup>
            <thead>
            <tr>
                <th align="center">用户id</th>
                <th align="center">用户名称</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="item:${userList}">
                <td align="center" class="userId" th:text="${item.id}"></td>
                <td align="center" th:text="${item.username}"></td>
                <!--<td><button class="addButton" type="button" onclick="addFriendButton()">添加ta为好友</button></td>-->
                <td><a th:href='@{/user/addFriend(id=${item.id})}'>添加ta为好友</a></td>
            </tr>
            </tbody>
        </table>
    </div>

</div>
</body>
</html>